Skip to content

gh-136438: Make sure test_generated_cases pass with all optimization levels #136594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

efimov-mikhail
Copy link
Contributor

@efimov-mikhail efimov-mikhail commented Jul 12, 2025

Now tests pass with all combinations of -OO and --without-doc-strings.

Before:

======================================================================
FAIL: test_missing_override_failure (test.test_generated_cases.TestGeneratedAbstractCases.test_missing_override_failure)
----------------------------------------------------------------------
AssertionError: 'case OP: {\n            JitOptRef out;\n [104 chars]   }' != ''
- case OP: {
-             JitOptRef out;
-             out = sym_new_not_null(ctx);
-             stack_pointer[-1] = out;
-             break;
-         }


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sikko/projects/cpython/Lib/test/test_generated_cases.py", line 2040, in test_missing_override_failure
    with self.assertRaisesRegex(AssertionError, "All abstract uops"):
         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: "All abstract uops" does not match "'case OP: {\n            JitOptRef out;\n [104 chars]   }' != ''
- case OP: {
-             JitOptRef out;
-             out = sym_new_not_null(ctx);
-             stack_pointer[-1] = out;
-             break;
-         }
"

@bedevere-app bedevere-app bot mentioned this pull request Jul 12, 2025
8 tasks
@efimov-mikhail efimov-mikhail changed the title gh-136438: Make sure test_generated_cases pass with all optimization levels gh-136438: Make sure test_generated_cases pass with all optimization levels Jul 12, 2025
@StanFromIreland StanFromIreland requested a review from sobolevn July 12, 2025 17:12
@efimov-mikhail
Copy link
Contributor Author

Cc @Eclips4

@Eclips4 Eclips4 self-requested a review July 19, 2025 09:18
abstract_uop_name in base_uop_names
), f"All abstract uops should override base uops, but {abstract_uop_name} is not."
if abstract_uop_name not in base_uop_names:
raise AssertionError(f"All abstract uops should override base uops, "
Copy link
Member

@Eclips4 Eclips4 Jul 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though I'm not sure, from an architectural point of view, that raising AssertionError manually is appropriate. I think we should change it to ValueError and handle it in the tests. WDYM?

Copy link
Contributor Author

@efimov-mikhail efimov-mikhail Jul 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm agree that raising ValueError would be better. My first attempt was just to make as few changes to code as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants